package com.svconnect.plugin.builders;

import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;


public class FileWriter {

	private String path;
	private File file;
	
	public FileWriter(String path) {
		this.path = path;
		this.file = new File(path);
	}
	
	public boolean setReadOnly() {
		return file.setReadOnly();
	}
	
	public void write(String content) throws IOException {
		File file = new File(path);
		if (file.exists()) {
			//throw new FileAlreadyExistsException(path);
			file.delete();
		}
		BufferedWriter bw = new BufferedWriter(new java.io.FileWriter(path));
		bw.write(content);
		bw.close();
	}
	
}
